package com.vhall.component.controller.room;

import com.vhall.component.entity.page.vo.PageVO;
import com.vhall.component.entity.room.vo.*;
import com.vhall.component.plugin.common.annotation.TokenAuth;
import com.vhall.component.service.room.RoomDraftRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 直播草稿
 *
 * @author xing.wang
 * @date 2023/8/10
 */
@RestController
@RequestMapping("/v4/room-draft")
@RequiredArgsConstructor
public class RoomDraftController {
    private final RoomDraftRecordService roomDraftRecordService;

    /**
     * 获取草稿信息详情
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @GetMapping("/get-info")
    public GetRoomDraftResponseVO getRoomDraftInfo(@Validated GetRoomDraftRequestVO vo) {
        return roomDraftRecordService.getRoomDraftInfo(vo);
    }

    /**
     * 获取关联房间草稿的投资依据列表
     * @param vo
     * @return
     */
    @TokenAuth
    @GetMapping("/invest_ref_list")
    public List<InvestRefResponseVO> getInvestRefList(@Validated RoomInvestRefRelationListRequestVO vo) {
        return roomDraftRecordService.getRoomDraftInvestRefList(vo);
    }

    /**
     * 获取草稿列表
     * @param vo
     * @return
     */
    @TokenAuth
    @GetMapping("/page-list")
    public PageVO<RoomDraftListResponseVO> pageList(@Validated RoomDraftPageListRequestVO vo) {
        return roomDraftRecordService.pageList(vo);
    }

    /**
     * 保存房间草稿
     *
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/save-draft")
    public Boolean saveRoomDraft(@RequestBody @Validated SaveRoomDraftRequestVO vo) {
        return roomDraftRecordService.saveRoomDraft(vo);
    }

    /**
     * 删除草稿
     * @param vo
     * @return
     */
    @TokenAuth
    @PostMapping("/delete")
    public Boolean deleteRoomDraft(@Validated DeleteRoomDraftRequestVO vo) {
        return roomDraftRecordService.deleteRoomDraft(vo);
    }
}
